package com.zte.claa.inficombo.csa.app.service.sapi.ffhost.bean;

import java.io.Serializable;

// 消防相关逻辑资源（设施）的基础数据，主要用于缓存.
@SuppressWarnings("serial")
public class FFResDevBase implements Serializable {
	public final static int CONN_STATE_NORMAL = 1;
	public final static int CONN_STATE_BROKE = 2;
	public final static int CONN_STATE_UNKNOWN = 3;
	
	private String transdevaddr;
	private int sysaddr = -1;
	private int systype = 0;
	private String partaddr = null;
	private int parttype = 0;
	
	private String deveui;
	private String devname; 
	private String devtype;
	private String projectid;
	
	public FFResDevBase() {
		
	}

	public String getTransdevaddr() {
		return transdevaddr;
	}

	public void setTransdevaddr(String transdevaddr) {
		this.transdevaddr = transdevaddr;
	}

	public int getSysaddr() {
		return sysaddr;
	}

	public void setSysaddr(int sysaddr) {
		this.sysaddr = sysaddr;
	}

	public String getPartaddr() {
		return partaddr;
	}

	public void setPartaddr(String partaddr) {
		this.partaddr = partaddr;
	}

	public String getDevtype() {
		return devtype;
	}

	public void setDevtype(String devtype) {
		this.devtype = devtype;
	}

	public String getProjectid() {
		return projectid;
	}

	public void setProjectid(String projectid) {
		this.projectid = projectid;
	}

	public String getDeveui() {
		return deveui;
	}

	public void setDeveui(String deveui) {
		this.deveui = deveui;
	}

	public String getDevname() {
		return devname;
	}

	public void setDevname(String devname) {
		this.devname = devname;
	}
	
	public int getSystype() {
		return systype;
	}

	public void setSystype(int systype) {
		this.systype = systype;
	}

	public int getParttype() {
		return parttype;
	}

	public void setParttype(int parttype) {
		this.parttype = parttype;
	}

	public String buildAddrCacheKey(){
		return FFResDevBase.buildAddrCacheKey(this.transdevaddr, this.sysaddr, this.partaddr);
	}
	
	public static String buildAddrCacheKey(String transdevaddr, int sysaddr, String partaddr) {
		StringBuilder sb = new StringBuilder();
		sb.append(transdevaddr);
		if(sysaddr >= 0){
			sb.append(".").append(sysaddr);
		}
		if(partaddr != null && !partaddr.equals("")){
			sb.append(".").append(partaddr);
		}
		return sb.toString();
	}
}
